import React from 'react'
import {getClassTwo,getClassAns} from '../../../../api/classify'
import ClassItem from './ClassItem/ClassItem'
interface IProps {
    classId: number
}
const SecondClass = (props: IProps) => {
    const [classInfo,setInfo] = React.useState<Array<any>>([{}])
    React.useEffect(() => {
        getClassTwo(props.classId)
            .then(res => {
                const {code,data} = res as unknown as getClassAns
                if(code === 200){
                    setInfo(data)
                }
            })
    },[props])
    return  (
        <>
        <div style={{
            maxHeight: '80vh',
            overflow: 'scroll'
        }}>
            {
                classInfo?.map(item => {
                    return (
                        <ClassItem key={item.moreId + item.moreName} item={item}/>
                    )
                })
            }
        </div>
        </>
    )
}

export default SecondClass